package com.gears_software.sxdc.dccx.ui.view;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.gears_software.sxdc.dccx.R;
import com.gears_software.sxdc.dccx.data.model.RechargeAmount;

import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById;

/**
 * Created by SunMuran on 2017/8/12.
 * 充值金额的view
 */
@EViewGroup(R.layout.item_view_recharge_amount)
public class RechargeAmountListItemView extends RelativeLayout {
    @ViewById
    TextView tv_chongzhi_jine;
    @ViewById
    TextView tv_zengsong_jine;
    @ViewById
    RelativeLayout re_bg;
    RechargeAmount model;
    Context context;

    public RechargeAmountListItemView(Context context) {
        super(context);
        this.context = context;
    }

    public void bind(RechargeAmount model) {
        this.model = model;
        if (model != null) {
            tv_chongzhi_jine.setText(model.getRechargeamount() + "元");
            tv_zengsong_jine.setText("赠送" + model.getGiveamount() + "元");
            if (model.isSelect()) {
                re_bg.setBackgroundResource(R.drawable.rounded_rectangle_orange);
                tv_chongzhi_jine.setTextColor(ContextCompat.getColor(context,R.color.colorFontOrange));
                tv_zengsong_jine.setTextColor(ContextCompat.getColor(context,R.color.colorFontOrange));
            }else{
                re_bg.setBackgroundResource(R.drawable.rounded_rectangle_gray);
                tv_chongzhi_jine.setTextColor(ContextCompat.getColor(context,R.color.colorFontGray));
                tv_zengsong_jine.setTextColor(ContextCompat.getColor(context,R.color.colorFontGray));
            }
        }
    }
}
